<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<div style="font-size: 20px; font-weight: bold; margin: 20px">Cart Details</div>

<div style="font-size: 20px; font-weight: bold; margin-left: 400px; color: #0F0;"><s:property value="#request.success" /></div>
<div style="font-size: 20px; font-weight: bold; margin-left: 400px; color: #F00;"><s:property value="#request.error" /></div>


<form name="cart" action="<s:url action="cart.action" />" method="get">
	<table style="text-align: center; margin: 20px">
		<tr>
			<th width="50" style="text-align: center; font-size: 20px; font-weight: bold; min-width: 20px !important">N.O</th>
			<th width="110" style="text-align: center; font-size: 20px; font-weight: bold">Picture</th>
			<th width="300" style="text-align: center; font-size: 20px; font-weight: bold">Product</th>
			<th width="78" style="text-align: center; font-size: 20px; font-weight: bold">Price</th>
			<th width="50" style="text-align: center; font-size: 20px; font-weight: bold">Quantity</th>
			<th width="100" style="text-align: center; font-size: 20px; font-weight: bold">Money</th>
			<th width="30"></th>
		</tr>
		
		<s:iterator status="product" value="#session.cart.listProduct">
			<tr>
				<td style="text-align: center; font-size: 15px; font-weight: bold"><s:property value="#product.index+1" /></td>
				<td><img src="<s:property value="productcart.getProductImages().iterator().next().getImageUrl()" />" width="100" height="100" /></td>
				<td style="text-align: center; font-size: 15px; font-weight: bold"><s:property value="productcart.getName()" /></td>
				<td style="text-align: center; font-size: 15px; font-weight: bold"><s:property value="productcart.getPrice()" /> $</td>
				<td>
					<s:select theme="simple" cssStyle="width: 100px;" name="quantity" list="#request.listnum" value="quantity" />
				</td>
				<td style="text-align: center; font-size: 15px; font-weight: bold;"><span style="color: #F30"><s:property value="price" /> $</span></td>
				<td><div class="button"><a href="<s:url action="cart.action"><s:param name="remove" value="#product.index" /></s:url>">Remove</a></div></td>
			</tr>
		</s:iterator>
		<tr>
			<th style="text-align: center; font-size: 20px; font-weight: bold"
				colspan="5">Ship</th>
			<td style="text-align: center; font-size: 15px; font-weight: bold;"><span
				style="color: #F30"><s:property value="#session.cart.ship" /> $</span></td>
		</tr>
		
		<tr>
			<th style="text-align: center; font-size: 20px; font-weight: bold"
				colspan="5">Taxes</th>
			<td style="text-align: center; font-size: 15px; font-weight: bold;"><span
				style="color: #F30"><s:property value="#session.cart.taxes" /> $</span></td>
		</tr>
		
		<tr>
			<th style="text-align: center; font-size: 20px; font-weight: bold"
				colspan="5">Total Money</th>
			<td style="text-align: center; font-size: 15px; font-weight: bold;"><span
				style="color: #F30"><s:property value="#session.cart.totalPrice" /> $</span></td>
		</tr>
		
	</table>
	<div style="padding-left: 100px; margin: 20px;">
	
		<span class="button" style="margin-left: 20px">
			<a href="<s:url action="info" namespace="/user">
                	<s:param name="action">viewcart</s:param>
                	</s:url> " style="font-size: 20px;">
	                	View History
	                </a>
		</span>
		
		<span class="button" style="margin-left: 200px">
			<input style="font-size: 20px" type="submit" value="Update" name="action"/>
		</span>
		
		<span class="button" style="margin-left: 165px">
			<a href="<s:url action="cart.action" namespace="/">
						<s:param name="action">Checkout</s:param>
						</s:url>" style="font-size: 20px">Check Out</a>
		</span>
		
	</div>
</form>